<template>
  <div class="batch-action-bar" v-if="selectedCount > 0">
    <div class="info">
      <el-icon><Select /></el-icon>
      <span>已选择 {{ selectedCount }} 个文件</span>
    </div>
    <div class="actions">
      <el-button type="danger" text @click="handleDelete">
        <el-icon><Delete /></el-icon>
        删除
      </el-button>
      <el-button type="primary" text @click="handleMove">
        <el-icon><FolderAdd /></el-icon>
        移动到
      </el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
/**
 * 批量操作栏组件
 * 
 * 功能：
 * 1. 显示当前选中的文件数量
 * 2. 提供批量删除和移动文件的操作按钮
 */
import { defineProps, defineEmits } from 'vue'
import { Select, Delete, FolderAdd } from '@element-plus/icons-vue'

/**
 * 组件属性
 */
const props = defineProps<{
  /** 选中的项目数量 */
  selectedCount: number
}>()

/**
 * 组件事件
 */
const emit = defineEmits<{
  /** 批量删除事件 */
  (e: 'batchDelete'): void
  /** 批量移动事件 */
  (e: 'batchMove'): void
}>()

/**
 * 处理批量删除事件
 */
const handleDelete = () => {
  emit('batchDelete')
}

/**
 * 处理批量移动事件
 */
const handleMove = () => {
  emit('batchMove')
}
</script>

<style lang="scss" scoped>
// 导入主题变量和混合器
@use '@/assets/styles/theme/base.scss' as *;
@use '@/assets/styles/mixins.scss' as *;

/**
 * 批量操作栏样式
 */
.batch-action-bar {
  height: 48px;
  padding: 0 24px;
  background: rgba($color-primary, 0.08);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba($color-primary, 0.1);
  @include flex-between;
  @include transition(all);
  animation: slideDown 0.3s ease;

  /**
   * 已选择信息
   */
  .info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: $color-primary;
    font-size: $font-size-body;

    .el-icon {
      font-size: 16px;
    }
  }

  /**
   * 批量操作按钮
   */
  .actions {
    display: flex;
    gap: 16px;

    :deep(.el-button) {
      height: 32px;
      padding: 0 16px;
      border-radius: $radius-medium;
      @include transition(all);
      display: flex;
      align-items: center;

      .el-icon {
        font-size: 16px;
        margin-right: 4px;
      }

      &.el-button--text {
        &:hover {
          background: rgba($color-primary, 0.1);
          transform: translateY(-1px);
        }

        &.el-button--danger:hover {
          color: $color-danger;
          background: rgba($color-danger, 0.1);
        }
      }
    }
  }
}

/**
 * 动画定义
 */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
</style> 